<!DOCTYPE html>
<html>
<head>
    <title>健康头条</title>
		<#include "/header.html">
</head>
<style>
    .el-upload__input {
        display: none !important;
    }
</style>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <div style="float: left;height:34px;line-height:34px;">医生名：</div>
            <div style="float: left;">
                <input type="text" class="form-control" v-model="q.dname" @keyup.enter="query" placeholder="医生名">
            </div>
            <div style="float: left;height:34px;line-height:34px;">评论时间：</div>
            <div style="float: left;width:350px;margin-right: 10px;" id="sandbox-container">

                <div class="input-group date" style="width:46%;float:left;">
                    <input type="text" class="form-control" id="startime" ><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
                </div>
                <div style="width: 4%;float:left;margin-left:7px;margin-top:8px;padding-left:1px;">
                    -
                </div>
                <div class="input-group date" style="width:48%;">
                    <input type="text" class="form-control" id="endtime" ><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
                </div>

            </div>
            <a class="btn btn-primary" @click="query">查询</a>
            <a class="btn btn-primary" @click="add">新增</a>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal" style="width: 1000px;">

                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>医生</div>
                        <div class="col-sm-10" style="width: 400px;">
                            <select class="form-control" v-model="healthheadline.userid"  id="doctor_id">

                            </select>
                        </div>
                    </div>

					<div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>问题</div>
                        <div class="col-sm-10">
                            <textarea v-model="healthheadline.content" cols="54" rows="4">

                            </textarea>
                        </div>
                    </div>
                    <div class="form-group" id="t1">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>图片</div>
                        <div class="col-sm-10">
                            <el-upload
                                    class="upload-demo"
                                    action="http://139.159.229.170:8081/renren-api/api/file/uploadfile"
                                    :on-preview="handlePreview"
                                    :on-remove="handleRemove"
                                    :file-list="fileList1"
                                    :on-success="handsuccess"
                                    list-type="picture">
                                <el-button size="small" type="primary">点击上传</el-button>
                            </el-upload>

                            <input type="text" class="form-control" v-model="healthheadline.imgurl" style="display: none;"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>解答</div>
                        <div class="col-sm-10" style="width: 700px;margin-top:5px;">
                            <textarea id="mytextarea">

                            </textarea>
                        </div>
                    </div>
							            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" id="btnSaveOrUpdate" data-loading-text="保存中..." @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
</div>

<script src="${request.contextPath}/statics/plugins/tinymce/js/tinymce/tinymce.min.js"></script>
<script src="${request.contextPath}/statics/js/modules/sys/healthheadline.js?_${.now?long}"></script>
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
    $("#sandbox-container .input-group.date").datepicker({
        language: "zh-CN",
        clearBtn: true, //清除按钮
        format: "yyyy-mm-dd",
        todayHighlight:true
    });
</script>
<script>
    tinymce.init({
        selector: '#mytextarea',
        language:'zh_CN',
        plugins: 'image',
        toolbar:[
            'paste | image | newdocument | bold| italic| underline| strikethrough| alignleft| alignright| alignjustify| styleselect',
            'formatselect| bullist| cut| copy|  numlist| outdent| blockquote| indent| undo| redo| removeformat| subscript| superscript',
        ],
        height: 600,
        images_upload_handler: function (blobInfo, succFun, failFun) {
            var xhr, formData;
            var file = blobInfo.blob();//转化为易于理解的file对象
            xhr = new XMLHttpRequest();
            xhr.withCredentials = false;
            xhr.open('POST',  baseURL + 'sys/upload/uploadImg');
            xhr.onload = function() {
                var json;
                json = JSON.parse(xhr.responseText);
                if (!json || typeof json.location != 'string') {
                    failFun('Invalid JSON: ' + xhr.responseText);
                    return;
                }
                succFun(json.location);
            };
            formData = new FormData();
            formData.append('file', file, file.name );//此处与源文档不一样
            xhr.send(formData);
        },
        powerpaste_word_import: 'propmt',// 参数可以是propmt, merge, clear，效果自行切换对比
        powerpaste_html_import: 'propmt',// propmt, merge, clear
        powerpaste_allow_local_images: true,
        paste_data_images: true,
    });
</script>
</body>
</html>